(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
isLeaf(leaf) → true
isLeaf(cons(u, v)) → false
left(cons(u, v)) → u
right(cons(u, v)) → v
concat(leaf, y) → y
concat(cons(u, v), y) → cons(u, concat(v, y))
less_leaves(u, v) → if1(isLeaf(u), isLeaf(v), u, v)
if1(b, true, u, v) → false
if1(b, false, u, v) → if2(b, u, v)
if2(true, u, v) → true
if2(false, u, v) → less_leaves(concat(left(u), right(u)), concat(left(v), right(v)))
Rewrite Strategy: FULL
(1) RenamingProof (EQUIVALENT transformation)
Renamed function symbols to avoid clashes with predefined symbol.
(2) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
isLeaf(leaf) → true
isLeaf(cons(u, v)) → false
left(cons(u, v)) → u
right(cons(u, v)) → v
concat(leaf, y) → y
concat(cons(u, v), y) → cons(u, concat(v, y))
less_leaves(u, v) → if1(isLeaf(u), isLeaf(v), u, v)
if1(b, true, u, v) → false
if1(b, false, u, v) → if2(b, u, v)
if2(true, u, v) → true
if2(false, u, v) → less_leaves(concat(left(u), right(u)), concat(left(v), right(v)))
S is empty.
Rewrite Strategy: FULL
(3) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(4) Obligation:
TRS:
Rules:
isLeaf(leaf) → true
isLeaf(cons(u, v)) → false
left(cons(u, v)) → u
right(cons(u, v)) → v
concat(leaf, y) → y
concat(cons(u, v), y) → cons(u, concat(v, y))
less_leaves(u, v) → if1(isLeaf(u), isLeaf(v), u, v)
if1(b, true, u, v) → false
if1(b, false, u, v) → if2(b, u, v)
if2(true, u, v) → true
if2(false, u, v) → less_leaves(concat(left(u), right(u)), concat(left(v), right(v)))
Types:
isLeaf :: leaf:cons → true:false
leaf :: leaf:cons
true :: true:false
cons :: leaf:cons → leaf:cons → leaf:cons
false :: true:false
left :: leaf:cons → leaf:cons
right :: leaf:cons → leaf:cons
concat :: leaf:cons → leaf:cons → leaf:cons
less_leaves :: leaf:cons → leaf:cons → true:false
if1 :: true:false → true:false → leaf:cons → leaf:cons → true:false
if2 :: true:false → leaf:cons → leaf:cons → true:false
hole_true:false1_0 :: true:false
hole_leaf:cons2_0 :: leaf:cons
gen_leaf:cons3_0 :: Nat → leaf:cons
(5) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
concat,
less_leavesThey will be analysed ascendingly in the following order:
concat < less_leaves
(6) Obligation:
TRS:
Rules:
isLeaf(
leaf) →
trueisLeaf(
cons(
u,
v)) →
falseleft(
cons(
u,
v)) →
uright(
cons(
u,
v)) →
vconcat(
leaf,
y) →
yconcat(
cons(
u,
v),
y) →
cons(
u,
concat(
v,
y))
less_leaves(
u,
v) →
if1(
isLeaf(
u),
isLeaf(
v),
u,
v)
if1(
b,
true,
u,
v) →
falseif1(
b,
false,
u,
v) →
if2(
b,
u,
v)
if2(
true,
u,
v) →
trueif2(
false,
u,
v) →
less_leaves(
concat(
left(
u),
right(
u)),
concat(
left(
v),
right(
v)))
Types:
isLeaf :: leaf:cons → true:false
leaf :: leaf:cons
true :: true:false
cons :: leaf:cons → leaf:cons → leaf:cons
false :: true:false
left :: leaf:cons → leaf:cons
right :: leaf:cons → leaf:cons
concat :: leaf:cons → leaf:cons → leaf:cons
less_leaves :: leaf:cons → leaf:cons → true:false
if1 :: true:false → true:false → leaf:cons → leaf:cons → true:false
if2 :: true:false → leaf:cons → leaf:cons → true:false
hole_true:false1_0 :: true:false
hole_leaf:cons2_0 :: leaf:cons
gen_leaf:cons3_0 :: Nat → leaf:cons
Generator Equations:
gen_leaf:cons3_0(0) ⇔ leaf
gen_leaf:cons3_0(+(x, 1)) ⇔ cons(leaf, gen_leaf:cons3_0(x))
The following defined symbols remain to be analysed:
concat, less_leaves
They will be analysed ascendingly in the following order:
concat < less_leaves
(7) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
concat(
gen_leaf:cons3_0(
n5_0),
gen_leaf:cons3_0(
b)) →
gen_leaf:cons3_0(
+(
n5_0,
b)), rt ∈ Ω(1 + n5
0)
Induction Base:
concat(gen_leaf:cons3_0(0), gen_leaf:cons3_0(b)) →RΩ(1)
gen_leaf:cons3_0(b)
Induction Step:
concat(gen_leaf:cons3_0(+(n5_0, 1)), gen_leaf:cons3_0(b)) →RΩ(1)
cons(leaf, concat(gen_leaf:cons3_0(n5_0), gen_leaf:cons3_0(b))) →IH
cons(leaf, gen_leaf:cons3_0(+(b, c6_0)))
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(8) Complex Obligation (BEST)
(9) Obligation:
TRS:
Rules:
isLeaf(
leaf) →
trueisLeaf(
cons(
u,
v)) →
falseleft(
cons(
u,
v)) →
uright(
cons(
u,
v)) →
vconcat(
leaf,
y) →
yconcat(
cons(
u,
v),
y) →
cons(
u,
concat(
v,
y))
less_leaves(
u,
v) →
if1(
isLeaf(
u),
isLeaf(
v),
u,
v)
if1(
b,
true,
u,
v) →
falseif1(
b,
false,
u,
v) →
if2(
b,
u,
v)
if2(
true,
u,
v) →
trueif2(
false,
u,
v) →
less_leaves(
concat(
left(
u),
right(
u)),
concat(
left(
v),
right(
v)))
Types:
isLeaf :: leaf:cons → true:false
leaf :: leaf:cons
true :: true:false
cons :: leaf:cons → leaf:cons → leaf:cons
false :: true:false
left :: leaf:cons → leaf:cons
right :: leaf:cons → leaf:cons
concat :: leaf:cons → leaf:cons → leaf:cons
less_leaves :: leaf:cons → leaf:cons → true:false
if1 :: true:false → true:false → leaf:cons → leaf:cons → true:false
if2 :: true:false → leaf:cons → leaf:cons → true:false
hole_true:false1_0 :: true:false
hole_leaf:cons2_0 :: leaf:cons
gen_leaf:cons3_0 :: Nat → leaf:cons
Lemmas:
concat(gen_leaf:cons3_0(n5_0), gen_leaf:cons3_0(b)) → gen_leaf:cons3_0(+(n5_0, b)), rt ∈ Ω(1 + n50)
Generator Equations:
gen_leaf:cons3_0(0) ⇔ leaf
gen_leaf:cons3_0(+(x, 1)) ⇔ cons(leaf, gen_leaf:cons3_0(x))
The following defined symbols remain to be analysed:
less_leaves
(10) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
less_leaves(
gen_leaf:cons3_0(
+(
1,
n548_0)),
gen_leaf:cons3_0(
n548_0)) →
false, rt ∈ Ω(1 + n548
0)
Induction Base:
less_leaves(gen_leaf:cons3_0(+(1, 0)), gen_leaf:cons3_0(0)) →RΩ(1)
if1(isLeaf(gen_leaf:cons3_0(+(1, 0))), isLeaf(gen_leaf:cons3_0(0)), gen_leaf:cons3_0(+(1, 0)), gen_leaf:cons3_0(0)) →RΩ(1)
if1(false, isLeaf(gen_leaf:cons3_0(0)), gen_leaf:cons3_0(1), gen_leaf:cons3_0(0)) →RΩ(1)
if1(false, true, gen_leaf:cons3_0(1), gen_leaf:cons3_0(0)) →RΩ(1)
false
Induction Step:
less_leaves(gen_leaf:cons3_0(+(1, +(n548_0, 1))), gen_leaf:cons3_0(+(n548_0, 1))) →RΩ(1)
if1(isLeaf(gen_leaf:cons3_0(+(1, +(n548_0, 1)))), isLeaf(gen_leaf:cons3_0(+(n548_0, 1))), gen_leaf:cons3_0(+(1, +(n548_0, 1))), gen_leaf:cons3_0(+(n548_0, 1))) →RΩ(1)
if1(false, isLeaf(gen_leaf:cons3_0(+(1, n548_0))), gen_leaf:cons3_0(+(2, n548_0)), gen_leaf:cons3_0(+(1, n548_0))) →RΩ(1)
if1(false, false, gen_leaf:cons3_0(+(2, n548_0)), gen_leaf:cons3_0(+(1, n548_0))) →RΩ(1)
if2(false, gen_leaf:cons3_0(+(2, n548_0)), gen_leaf:cons3_0(+(1, n548_0))) →RΩ(1)
less_leaves(concat(left(gen_leaf:cons3_0(+(2, n548_0))), right(gen_leaf:cons3_0(+(2, n548_0)))), concat(left(gen_leaf:cons3_0(+(1, n548_0))), right(gen_leaf:cons3_0(+(1, n548_0))))) →RΩ(1)
less_leaves(concat(leaf, right(gen_leaf:cons3_0(+(2, n548_0)))), concat(left(gen_leaf:cons3_0(+(1, n548_0))), right(gen_leaf:cons3_0(+(1, n548_0))))) →RΩ(1)
less_leaves(concat(leaf, gen_leaf:cons3_0(+(1, n548_0))), concat(left(gen_leaf:cons3_0(+(1, n548_0))), right(gen_leaf:cons3_0(+(1, n548_0))))) →LΩ(1)
less_leaves(gen_leaf:cons3_0(+(0, +(1, n548_0))), concat(left(gen_leaf:cons3_0(+(1, n548_0))), right(gen_leaf:cons3_0(+(1, n548_0))))) →RΩ(1)
less_leaves(gen_leaf:cons3_0(+(1, n548_0)), concat(leaf, right(gen_leaf:cons3_0(+(1, n548_0))))) →RΩ(1)
less_leaves(gen_leaf:cons3_0(+(1, n548_0)), concat(leaf, gen_leaf:cons3_0(n548_0))) →LΩ(1)
less_leaves(gen_leaf:cons3_0(+(1, n548_0)), gen_leaf:cons3_0(+(0, n548_0))) →IH
false
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(11) Complex Obligation (BEST)
(12) Obligation:
TRS:
Rules:
isLeaf(
leaf) →
trueisLeaf(
cons(
u,
v)) →
falseleft(
cons(
u,
v)) →
uright(
cons(
u,
v)) →
vconcat(
leaf,
y) →
yconcat(
cons(
u,
v),
y) →
cons(
u,
concat(
v,
y))
less_leaves(
u,
v) →
if1(
isLeaf(
u),
isLeaf(
v),
u,
v)
if1(
b,
true,
u,
v) →
falseif1(
b,
false,
u,
v) →
if2(
b,
u,
v)
if2(
true,
u,
v) →
trueif2(
false,
u,
v) →
less_leaves(
concat(
left(
u),
right(
u)),
concat(
left(
v),
right(
v)))
Types:
isLeaf :: leaf:cons → true:false
leaf :: leaf:cons
true :: true:false
cons :: leaf:cons → leaf:cons → leaf:cons
false :: true:false
left :: leaf:cons → leaf:cons
right :: leaf:cons → leaf:cons
concat :: leaf:cons → leaf:cons → leaf:cons
less_leaves :: leaf:cons → leaf:cons → true:false
if1 :: true:false → true:false → leaf:cons → leaf:cons → true:false
if2 :: true:false → leaf:cons → leaf:cons → true:false
hole_true:false1_0 :: true:false
hole_leaf:cons2_0 :: leaf:cons
gen_leaf:cons3_0 :: Nat → leaf:cons
Lemmas:
concat(gen_leaf:cons3_0(n5_0), gen_leaf:cons3_0(b)) → gen_leaf:cons3_0(+(n5_0, b)), rt ∈ Ω(1 + n50)
less_leaves(gen_leaf:cons3_0(+(1, n548_0)), gen_leaf:cons3_0(n548_0)) → false, rt ∈ Ω(1 + n5480)
Generator Equations:
gen_leaf:cons3_0(0) ⇔ leaf
gen_leaf:cons3_0(+(x, 1)) ⇔ cons(leaf, gen_leaf:cons3_0(x))
No more defined symbols left to analyse.
(13) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
concat(gen_leaf:cons3_0(n5_0), gen_leaf:cons3_0(b)) → gen_leaf:cons3_0(+(n5_0, b)), rt ∈ Ω(1 + n50)
(14) BOUNDS(n^1, INF)
(15) Obligation:
TRS:
Rules:
isLeaf(
leaf) →
trueisLeaf(
cons(
u,
v)) →
falseleft(
cons(
u,
v)) →
uright(
cons(
u,
v)) →
vconcat(
leaf,
y) →
yconcat(
cons(
u,
v),
y) →
cons(
u,
concat(
v,
y))
less_leaves(
u,
v) →
if1(
isLeaf(
u),
isLeaf(
v),
u,
v)
if1(
b,
true,
u,
v) →
falseif1(
b,
false,
u,
v) →
if2(
b,
u,
v)
if2(
true,
u,
v) →
trueif2(
false,
u,
v) →
less_leaves(
concat(
left(
u),
right(
u)),
concat(
left(
v),
right(
v)))
Types:
isLeaf :: leaf:cons → true:false
leaf :: leaf:cons
true :: true:false
cons :: leaf:cons → leaf:cons → leaf:cons
false :: true:false
left :: leaf:cons → leaf:cons
right :: leaf:cons → leaf:cons
concat :: leaf:cons → leaf:cons → leaf:cons
less_leaves :: leaf:cons → leaf:cons → true:false
if1 :: true:false → true:false → leaf:cons → leaf:cons → true:false
if2 :: true:false → leaf:cons → leaf:cons → true:false
hole_true:false1_0 :: true:false
hole_leaf:cons2_0 :: leaf:cons
gen_leaf:cons3_0 :: Nat → leaf:cons
Lemmas:
concat(gen_leaf:cons3_0(n5_0), gen_leaf:cons3_0(b)) → gen_leaf:cons3_0(+(n5_0, b)), rt ∈ Ω(1 + n50)
less_leaves(gen_leaf:cons3_0(+(1, n548_0)), gen_leaf:cons3_0(n548_0)) → false, rt ∈ Ω(1 + n5480)
Generator Equations:
gen_leaf:cons3_0(0) ⇔ leaf
gen_leaf:cons3_0(+(x, 1)) ⇔ cons(leaf, gen_leaf:cons3_0(x))
No more defined symbols left to analyse.
(16) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
concat(gen_leaf:cons3_0(n5_0), gen_leaf:cons3_0(b)) → gen_leaf:cons3_0(+(n5_0, b)), rt ∈ Ω(1 + n50)
(17) BOUNDS(n^1, INF)
(18) Obligation:
TRS:
Rules:
isLeaf(
leaf) →
trueisLeaf(
cons(
u,
v)) →
falseleft(
cons(
u,
v)) →
uright(
cons(
u,
v)) →
vconcat(
leaf,
y) →
yconcat(
cons(
u,
v),
y) →
cons(
u,
concat(
v,
y))
less_leaves(
u,
v) →
if1(
isLeaf(
u),
isLeaf(
v),
u,
v)
if1(
b,
true,
u,
v) →
falseif1(
b,
false,
u,
v) →
if2(
b,
u,
v)
if2(
true,
u,
v) →
trueif2(
false,
u,
v) →
less_leaves(
concat(
left(
u),
right(
u)),
concat(
left(
v),
right(
v)))
Types:
isLeaf :: leaf:cons → true:false
leaf :: leaf:cons
true :: true:false
cons :: leaf:cons → leaf:cons → leaf:cons
false :: true:false
left :: leaf:cons → leaf:cons
right :: leaf:cons → leaf:cons
concat :: leaf:cons → leaf:cons → leaf:cons
less_leaves :: leaf:cons → leaf:cons → true:false
if1 :: true:false → true:false → leaf:cons → leaf:cons → true:false
if2 :: true:false → leaf:cons → leaf:cons → true:false
hole_true:false1_0 :: true:false
hole_leaf:cons2_0 :: leaf:cons
gen_leaf:cons3_0 :: Nat → leaf:cons
Lemmas:
concat(gen_leaf:cons3_0(n5_0), gen_leaf:cons3_0(b)) → gen_leaf:cons3_0(+(n5_0, b)), rt ∈ Ω(1 + n50)
Generator Equations:
gen_leaf:cons3_0(0) ⇔ leaf
gen_leaf:cons3_0(+(x, 1)) ⇔ cons(leaf, gen_leaf:cons3_0(x))
No more defined symbols left to analyse.
(19) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
concat(gen_leaf:cons3_0(n5_0), gen_leaf:cons3_0(b)) → gen_leaf:cons3_0(+(n5_0, b)), rt ∈ Ω(1 + n50)
(20) BOUNDS(n^1, INF)